<HTML><HEAD><TITLE>mzn_load(++ModelFile, ++SolverOrOptions, ++ParMap, +VarMap, -FznState)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">library(minizinc)</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>mzn_load(++ModelFile, ++SolverOrOptions, ++ParMap, +VarMap, -FznState)</H1>
Load a MiniZinc model from a file
<DL>
<DT><EM>ModelFile</EM></DT>
<DD>File name (extension defaults to .mzn)
</DD>
<DT><EM>SolverOrOptions</EM></DT>
<DD>Name of solver mapping module, or zn_options-structure
</DD>
<DT><EM>ParMap</EM></DT>
<DD>List of FznId=ECLiPSeGroundTerm correspondences
</DD>
<DT><EM>VarMap</EM></DT>
<DD>List of FznId=ECLiPSeVarTerm correspondences
</DD>
<DT><EM>FznState</EM></DT>
<DD>FlatZinc state descriptor
</DD>
</DL>
<H2>Description</H2>
<P>
	Loads a MiniZinc from ModelFile.  The problem is set up using
	a mapping to a concrete ECLiPSe solver, as specified in the
	SolverOrOptions argument.  Neither search nor output are done.
    </P><P>
	To pass parameters into the model, a ParMap can be given, consisting
	of a list of FznId=ECLiPSeGroundTerm correspondences.  Here, FznId
	is an atom (the FlatZinc parameter identifier within the model),
	and ECLiPSeGroundTerm is the corresponding ECLiPSe constant.
    </P><P>
    	To access the ECLiPSe variables corresponding to the model's
	variables, VarMap can be given, consisting of a list of
	FznId=ECLiPSeTerm correspondences.  Here, FznId is an atom
	(the FlatZinc variable identifier within the model), and
	ECLiPSeTerm is the corresponding ECLiPSe constant, variable
	or array.
    </P><P>
    	The mzn_load/5 predicate returns a FlatZinc solver
	state which can be used to lookup further information about
	the model (fzn_var_lookup/3, fzn_obj_lookup/2), to perform
	the standard search (fzn_search/1), or to perform the model's
	output actions (fzn_output/1).
    </P>
<H3>Modes and Determinism</H3><UL>
<LI>mzn_load(++, ++, ++, +, -) is semidet
</UL>
<H3>Fail Conditions</H3>
Fails if the constraint setup fails
<H2>Examples</H2>
<PRE>
    ?- mzn_load("queens", fzn_ic, [n=8], [q=Q], FznState).

    Q = [](_2492{1..8}, _2512{1..8}, _2532{1..8}, _2552{1..8}, ...]
    FznState = state(...)
    There are 84 delayed goals.
    Yes (0.02s cpu)


    ?- mzn_load("queens", fzn_ic, [n=8], [q=Q], FznState),
       ic:labeling(Q).

    Q = [](1, 5, 8, 6, 3, 7, 2, 4)
    FznState = state(...)
    Yes (0.03s cpu, solution 1, maybe more)


    ?- mzn_load("queens", fzn_ic, [n=8], [q=Q], FznState),
       ic:labeling(Q),
       fzn_output(FznState).

    % output from fzn_output:
    q = [1,5,8,6,3,7,2,4]
    Total time 0.030s cpu (0.020 setup)

    % output from ECLiPSe toplevel:
    Q = [](1, 5, 8, 6, 3, 7, 2, 4)
    FznState = state(...)
    Yes (0.03s cpu, solution 1, maybe more)
&lt;/PRE&gt;
</PRE>
<H2>See Also</H2>
<A HREF="../../lib_public/minizinc/mzn_run-2.html">mzn_run / 2</A>, <A HREF="../../lib_public/minizinc/mzn_run-3.html">mzn_run / 3</A>, <A HREF="../../lib_public/minizinc/mzn_load_string-5.html">mzn_load_string / 5</A>, <A HREF="../../lib_public/flatzinc/zn_options-s.html">flatzinc : struct(zn_options)</A>
</BODY></HTML>
